/*
 * move.h
 *
 *  Created on: Apr 16, 2013
 *      Author: snirgaz
 */

#ifndef MOVE_H_
#define MOVE_H_

#include "HelpLibs/def.h"
#include "Bisection.h"
#include "HelpLibs/RandomGen.h"
#include "HelpLibs/QmcParameters.h"
#include "WorldLines.h"

class Move {
protected:
	WorldLines *wl_;
	Bisection *bisection_;
	UniformReal uniZeroOne_;
	MoveParams *moveParams_;
	int M_;
	// Qmc Parameters
	SimulationParameters *simParams_;
public:
	Move();
	virtual ~Move();
	bool accept(double p);
};

class OpenMove: Move {
private:
	// Draws position of the "Jump Move"
	UniformInt posOpen_;
	// Draws Starting Time Slice
	UniformInt mStart_;
	// Draws PArticle Number
	UniformInt particleNum_;
public:
	void init(SimulationParameters *simParams, WorldLines * wl,
			Bisection * bisection, MTGen *rngGen, MoveParams *moveParams);
	bool makeMove();
	void updateConf();
	// Calculate Open closed Ratio
	double rhoOpenClosed();
};

class CloseMove: Move {
private:
	// Draws position of the "Jump Move"
	UniformInt posClose_;
public:
	void init(SimulationParameters *simParams, WorldLines * wl,
			Bisection * bisection, MTGen *rngGen, MoveParams *moveParams);
	bool makeMove();
	void updateConf();
	// Calculate Open closed Ratio
	double rhoOpenClosed();
};

class WiggleMove: Move {
private:
	// Draws position of the "Jump Move"
	UniformInt posWiggle_;
public:
	void init(SimulationParameters *simParams, WorldLines * wl,
			Bisection * bisection, MTGen *rngGen, MoveParams *moveParams);
	bool makeMove();
	void updateConf();
};

class SwapMove: Move {
private:
	int wlOriginalBegin_, wlOriginalEnd_, wlSwapToBegin_, wlSwapToEnd_;
	double swapRatio_;
	DoubleVec rho_;
	int numP_;
public:
	void init(SimulationParameters *simParams, WorldLines * wl,
			Bisection * bisection, MTGen *rngGen, MoveParams *moveParams);
	bool makeMove();
	bool rhoSwap();
	// Claculates Kinetic energy from original
	void sigmaSwap(int original);
	void updateConf();
};

#endif /* MOVE_H_ */
